package com.ruoyi.web.controller.cs;

import java.util.List;

import com.ruoyi.common.core.controller.BasicsController;
import com.ruoyi.common.core.domain.Response;
import com.ruoyi.common.core.page.ResponsePageInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import com.ruoyi.cs.domain.TRobotBehavior;
import com.ruoyi.cs.service.ITRobotBehaviorService;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;

/**
 * 机器人行为记录Controller
 * 
 * @author ruoyi
 * @date 2021-04-02
 */
@Api(tags = {"机器人行为记录"})
@RestController
@RequestMapping("/cs/behavior")
public class TRobotBehaviorController extends BasicsController
{
    @Autowired
    private ITRobotBehaviorService tRobotBehaviorService;

    /**
     * 查询机器人行为记录列表
     */
    @ApiOperation("查询机器人行为记录列表")
    @PreAuthorize("@ss.hasPermi('buff:behavior:list')")
    @GetMapping("/list")
    public ResponsePageInfo<TRobotBehavior> list(TRobotBehavior tRobotBehavior)
    {
        startPage();
        List<TRobotBehavior> list = tRobotBehaviorService.selectTRobotBehaviorList(tRobotBehavior);
        return toResponsePageInfo(list);
    }

    /**
     * 获取机器人行为记录详细信息
     */
    @ApiOperation("获取机器人行为记录详细信息")
    @PreAuthorize("@ss.hasPermi('buff:behavior:query')")
    @GetMapping(value = "/{xwId}")
    public Response getInfo(@PathVariable("xwId") String xwId)
    {
        return Response.success(tRobotBehaviorService.selectTRobotBehaviorById(xwId));
    }

    /**
     * 新增机器人行为记录
     */
    @ApiOperation("新增机器人行为记录")
    @PreAuthorize("@ss.hasPermi('buff:behavior:add')")
    @Log(title = "机器人行为记录", businessType = BusinessType.INSERT)
    @PostMapping
    public Response add(@RequestBody TRobotBehavior tRobotBehavior)
    {
        return toResponse(tRobotBehaviorService.insertTRobotBehavior(tRobotBehavior));
    }

    /**
     * 修改机器人行为记录
     */
    @ApiOperation("修改机器人行为记录")
    @PreAuthorize("@ss.hasPermi('buff:behavior:edit')")
    @Log(title = "机器人行为记录", businessType = BusinessType.UPDATE)
    @PutMapping
    public Response edit(@RequestBody TRobotBehavior tRobotBehavior)
    {
        return toResponse(tRobotBehaviorService.updateTRobotBehavior(tRobotBehavior));
    }

    /**
     * 删除机器人行为记录
     */
    @ApiOperation("删除机器人行为记录")
    @PreAuthorize("@ss.hasPermi('buff:behavior:remove')")
    @Log(title = "机器人行为记录", businessType = BusinessType.DELETE)
	@DeleteMapping("/{xwIds}")
    public Response remove(@PathVariable String[] xwIds)
    {
        return toResponse(tRobotBehaviorService.deleteTRobotBehaviorByIds(xwIds));
    }
}
